c# accept any enum

88

c# accept any enum -

public static void MyFunction<T>(T en) where T: IComparable, IFormattable, IConvertible
{
    if (!typeof(T).IsEnum)
        throw new ArgumentException("en must be enum type");
    // implementation
}

Comments

Submit
0 Comments